
<%@ page import="duylinh.SanPham" %>
<!doctype html>
<html>
	<head>
		<meta name="layout" content="main">
		<g:set var="entityName" value="${message(code: 'sanPham.label', default: 'SanPham')}" />
		<title><g:message code="default.show.label" args="[entityName]" /></title>
	</head>
	<body>
		<a href="#show-sanPham" class="skip" tabindex="-1"><g:message code="default.link.skip.label" default="Skip to content&hellip;"/></a>
		<div class="nav" role="navigation">
			<ul>
				<li>
                    <g:link class="list" action="list">
                        <g:message code="default.list.sanpham"  />
                    </g:link>
                </li>
				<li>
                    <g:link class="create" action="createEditProduct">
                        <g:message code="default.new.sanphamMoi" />
                    </g:link>
                </li>
			</ul>
		</div>

		<div id="show-sanPham" class="content scaffold-show" role="main">

			<h1>
                <div class=" fontBold">
                    <g:if test="${sanPhamInstance?.loaiSanPham}">
                        ${sanPhamInstance?.loaiSanPham?.ten}
                    </g:if>

                    <g:if test="${sanPhamInstance?.code}">
                        <g:fieldValue bean="${sanPhamInstance}" field="code"/>
                    </g:if>
                </div>
            </h1>

			<g:if test="${flash.message}">
			<div class="message" role="status">${flash.message}</div>
			</g:if>

            <div id="sanPhamDiv" class="floatL marginRightStd marginTopLarge">
                <g:if test="${sanPhamInstance?.avatarUrl}">

                    <div class=" fontBold" style="margin-left: 90px;">
                        <g:if test="${sanPhamInstance?.loaiSanPham}">
                           ${sanPhamInstance?.loaiSanPham?.ten}
                        </g:if>

                        <g:if test="${sanPhamInstance?.code}">
                            <g:fieldValue bean="${sanPhamInstance}" field="code"/>
                        </g:if>
                    </div>

                    <div class="fieldcontain">
                        <span class=" property-value" aria-labelledby="loai-label">

                            <a href="${dl.getSanPhamPhoto(['sanPham':sanPhamInstance])}" class="anhSanPham">
                                <img class="anhSanPhamImg" src="${sanPhamInstance?.avatarUrl}"/>
                            </a>

                            <g:javascript>

                            $(function() {
                                $('.anhSanPham').lightBox({
                                                            imageLoading:			'${request.contextPath}/images/lightbox-ico-loading.gif',		// (string) Path and the name of the loading icon
                                                            imageBtnPrev:			'${request.contextPath}/images/lightbox-btn-prev.gif',			// (string) Path and the name of the prev button image
                                                            imageBtnNext:			'${request.contextPath}/images/lightbox-btn-next.gif',			// (string) Path and the name of the next button image
                                                            imageBtnClose:			'${request.contextPath}/images/lightbox-btn-close.gif',		// (string) Path and the name of the close btn
                                                            imageBlank:	            '${request.contextPath}/images/lightbox-blank.gif'})
                                                         });

                            </g:javascript>
                        </span>

                    </div>
                </g:if>
            </div>

            <div id="sanPhamInfoDiv" class="floatL">
                <ol class="property-list sanPham">

                    <g:if test="${sanPhamInstance?.loaiSanPham}">
                        <li class="fieldcontain">
                            <span id="loai-label" class="property-label"><g:message code="sanPham.loai.label" default="Loai" /></span>

                            <span class="property-value" aria-labelledby="loai-label">
                                ${sanPhamInstance?.loaiSanPham?.ten}
                            </span>

                        </li>
                    </g:if>

                    <g:if test="${sanPhamInstance?.code}">
                        <li class="fieldcontain">
                            <span id="code-label" class="property-label"><g:message code="sanPham.code.label" default="Code" /></span>

                            <span class="property-value" aria-labelledby="code-label"><g:fieldValue bean="${sanPhamInstance}" field="code"/></span>

                        </li>
                    </g:if>

                    <g:if test="${sanPhamInstance?.hangMuc}">
                        <li class="fieldcontain">
                            <span id="hangMuc-label" class="property-label"><g:message code="sanPham.hangMuc.label" default="Hang Muc" /></span>

                            <span class="property-value" aria-labelledby="hangMuc-label">
                                <g:message code="hangmuc.${sanPhamInstance?.hangMuc}"></g:message>

                            </span>

                        </li>
                    </g:if>

                    <g:if test="${sanPhamInstance?.donviSanPham}">
                        <li class="fieldcontain">
                            <span id="donviSanPham-label" class="property-label"><g:message code="sanPham.donviSanPham.label"  /></span>

                            <span class="property-value" aria-labelledby="donviSanPham-label">${sanPhamInstance?.donviSanPham?.ten}</span>

                        </li>
                    </g:if>


                    <g:if test="${sanPhamInstance?.trongLuong}">
                        <li class="fieldcontain">
                            <span id="trongLuong-label" class="property-label"><g:message code="sanPham.trongLuong.label"  /></span>

                            <span class="property-value" aria-labelledby="trongLuong-label">
                                   ${sanPhamInstance?.trongLuong}   ${sanPhamInstance?.trongLuongDonvi}
                            </span>

                        </li>
                    </g:if>

                    <g:if test="${sanPhamInstance?.vatLieu}">
                        <li class="fieldcontain">
                            <span id="vatLieu-label" class="property-label"><g:message code="sanPham.vatLieu.label" default="Vat Lieu" /></span>

                            <span class="property-value" aria-labelledby="vatLieu-label">
                                <g:link controller="vatLieu" action="show" id="${sanPhamInstance?.vatLieu?.id}">
                                    ${sanPhamInstance?.vatLieu?.chatLieu?.encodeAsHTML()} ${sanPhamInstance?.vatLieu?.ten?.encodeAsHTML()}
                                </g:link>
                            </span>

                        </li>
                    </g:if>

                    <g:if test="${sanPhamInstance?.congNghe}">
                        <li class="fieldcontain">
                            <span id="congNghe-label" class="property-label"><g:message code="sanPham.congNghe.label" default="Cong Nghe" /></span>
                            <span class="property-value" aria-labelledby="congNghe-label">
                                <g:link controller="congNghe" action="show" id="${sanPhamInstance?.congNghe?.id}">${sanPhamInstance?.congNghe?.ten?.encodeAsHTML()}</g:link>
                            </span>

                        </li>

                        <li class="fieldcontain">
                            <span id="congNghe-label" class="property-label"><g:message code="sanPham.congNghe.tyleThanhPham" default="Ty Le Thanh Pham" /></span>

                            <span class="property-value" aria-labelledby="congNghe-label">
                                ${sanPhamInstance?.congNghe?.tyLeThanhPham?.encodeAsHTML()}  %
                            </span>

                        </li>

                        <li class="fieldcontain">
                            <span id="congNghe-label" class="property-label"><g:message code="sanPham.congNghe.dinhMucSanPham" default="Dinh Muc San Pham" /></span>

                            <span class="property-value" aria-labelledby="congNghe-label">
                                ${sanPhamInstance?.congNghe?.dinhMucSP?.encodeAsHTML()}  ${sanPhamInstance?.congNghe?.dinhmucSPDonvi?.encodeAsHTML()} / 1 Kg
                            </span>

                        </li>

                    </g:if>

                    <g:if test="${sanPhamInstance?.khachHangChinh}">
                        <li class="fieldcontain">
                            <span id="khachHangChinh-label" class="property-label"><g:message code="sanPham.khachHangChinh.label" default="Khach Hang Chinh" /></span>

                            <span class="property-value" aria-labelledby="khachHangChinh-label"><g:link controller="khachHang" action="show" id="${sanPhamInstance?.khachHangChinh?.id}">${sanPhamInstance?.khachHangChinh?.encodeAsHTML()}</g:link></span>

                        </li>
                    </g:if>

                    <g:if test="${sanPhamInstance?.dodayMax}">
                        <li class="fieldcontain">
                            <span id="dodayMax-label" class="property-label"><g:message code="sanPham.dodayMax.label" default="Doday Max" /></span>

                            <span class="property-value" aria-labelledby="dodayMax-label"><g:fieldValue bean="${sanPhamInstance}" field="dodayMax"/></span>

                        </li>
                    </g:if>

                    <g:if test="${sanPhamInstance?.dodayMin}">
                        <li class="fieldcontain">
                            <span id="dodayMin-label" class="property-label"><g:message code="sanPham.dodayMin.label" default="Doday Min" /></span>

                            <span class="property-value" aria-labelledby="dodayMin-label"><g:fieldValue bean="${sanPhamInstance}" field="dodayMin"/></span>

                        </li>
                    </g:if>

                    <g:if test="${sanPhamInstance?.ghiChu}">
                        <li class="fieldcontain">
                            <span id="ghiChu-label" class="property-label"><g:message code="sanPham.ghiChu.label" default="Ghi Chu" /></span>

                            <span class="property-value" aria-labelledby="ghiChu-label"><g:fieldValue bean="${sanPhamInstance}" field="ghiChu"/></span>

                        </li>
                    </g:if>

                    <g:if test="${sanPhamInstance?.priceBeforeTax}">
                        <li class="fieldcontain">
                            <span id="priceBeforeTax-label" class="property-label"><g:message code="sanPham.priceBeforeTax.label" default="priceBeforeTax" /></span>

                            <span class="property-value" aria-labelledby="priceBeforeTax-label">
                                <g:formatNumber locale="fi_FI" number="${sanPhamInstance?.priceBeforeTax}"  type="currency" currencyCode="VND"></g:formatNumber>
                            </span>

                        </li>


                        <li class="fieldcontain">
                            <span id="tax-label" class="property-label">
                                <g:message code="sanPham.tax" default="Thue" />
                            </span>

                            <span class="property-value" aria-labelledby="tax-label">
                                10 %
                            </span>

                        </li>

                        <li class="fieldcontain">
                            <span id="priceAfterTax-label" class="property-label">
                                <g:message code="sanPham.priceAfterTax" default="Gia Sau Thue" />
                            </span>

                            <span class="property-value" aria-labelledby="priceAfterTax-label">
                               <g:formatNumber locale="fi_FI" number="${sanPhamInstance?.priceBeforeTax * 1.1}"  type="currency" currencyCode="VND"></g:formatNumber>
                            </span>

                        </li>
                    </g:if>

                    <g:if test="${sanPhamInstance?.creator}">
                        <li class="fieldcontain">
                            <span id="hangMuc-label" class="property-label"><g:message code="sanPham.creator.label"  /></span>

                            <span class="property-value" aria-labelledby="hangMuc-label">
                                ${sanPhamInstance?.creator?.ten}
                            </span>
                            <span class="property-value" aria-labelledby="hangMuc-label">
                                <g:formatDate format="dd-MM-yyyy   hh:mm" date="${sanPhamInstance?.dateCreated}" />
                            </span>
                        </li>
                    </g:if>

                    <g:if test="${sanPhamInstance?.updater}">
                        <li class="fieldcontain">
                            <span id="hangMuc-label" class="property-label"><g:message code="sanPham.updater.label"  /></span>

                            <span class="property-value" aria-labelledby="hangMuc-label">${sanPhamInstance?.updater?.ten}</span>
                            <span class="property-value" aria-labelledby="hangMuc-label">
                                <g:formatDate format="dd-MM-yyyy   hh:mm" date="${sanPhamInstance?.lastUpdated}" />
                            </span>
                        </li>
                    </g:if>

                </ol>
            </div>

            <div class="clear"></div>


			<g:form>
				<fieldset class="buttons">
					<g:hiddenField name="id" value="${sanPhamInstance?.id}" />

					<g:link class="edit" action="createEditProduct" params="['sanPhamId':sanPhamInstance?.id]" >
                        <g:message code="default.button.edit.label" default="Edit" />
                    </g:link>

					<g:actionSubmit class="" action="delete" value="${message(code: 'default.button.delete.label', default: 'Delete')}" onclick="return confirm('${message(code: 'default.button.delete.confirm.message', default: 'Are you sure?')}');" />

				</fieldset>
			</g:form>
		</div>
	</body>
</html>
